<template>
  <div>
    <van-nav-bar title="设备" left-arrow  @click-left="onClickLeft"/>
    <!-- 下拉列表 -->
    <van-dropdown-menu>
      <van-dropdown-item v-model="value" :options="option" />
    </van-dropdown-menu>

    <!-- 搜索框 -->
    <van-search v-model="inpValue" 
        placeholder="请输入搜索关键词" 
        left-icon 
        @keydown.13="searchVal"
    />
    <van-icon name="search" class="searchIcon" @click="searchVal"/>
  </div>
</template>

<script>
export default {
  name: 'DeviceList',
  data(){
    return{
       // 搜索框
      inpValue:'',
      //  下拉框
      value: 0,
      option: [
        { text: "设备MEI", value: 0 },
        { text: "传感器编号", value: 1 },
        { text: "医院名称", value: 2 },
        { text: "医院渠道", value: 3 },
      ],
    }
  },
  methods: {
    onClickLeft() {
      console.log('1');
    },
    searchVal(){
      console.log(`查询 ${this.inpValue} 相关内容`);
    }
  },
}
</script>

<style>
/* 下拉列表 */
div.van-dropdown-menu__bar {
  width: 110px;
  height: 30px;
  border: 1px solid #eee;
  border-radius: 6px;
  margin-left: 5px;
}
/* 搜索框 */
div.van-search{
  background-color: white;
  width: 250px;
  position: absolute;
  right: 5px;
  top: 46px;
  padding: 0px;
}
div.van-search__content.van-search__content--square{
  background-color: white;
  border: 1px solid #eee;
}
/* 搜索按钮 */
.searchIcon.van-icon.van-icon-search{
  width: 36px;
  height: 36px;
  background-color: #eee;
  position: absolute;
  right: 5px;
  top: 46px;
  z-index: 10;
  text-align: center;
  line-height: 36px;
}
</style>